package com.atcd.springcloud.controller;


import com.atcd.springcloud.entities.Payment;
import com.atcd.springcloud.entities.ResponseResult;
import com.atcd.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("consumer")
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    //消费方80的接口层
    @GetMapping("/payment/get/{id}")
    public ResponseResult<Payment> getPaymentById(@PathVariable("id") Long id){
       return paymentFeignService.get(id);
    }


    @GetMapping("/payment/feign/timeout")
    public  String paymentFeignTimeout(){
        //openfiegn-ribbon ,客户端一般默认等待1秒钟
        return paymentFeignService.paymentFeignTimeout();
    }
}
